﻿$(document).ready(function(){


//var user = functions.ParseJSON(functions.GetItemInLocalStorage('user'));
var local = 'http://192.168.0.10:61662/Flingz.svc/';
var beta = 'http://wsflingz.azurewebsites.net/Flingz.svc/';
var serv = local;
var req;
var salt = 't8!g312?vspm';
var action;
  //alert(document.location);
    //alert(url.substring(url.lastIndexOf("=")+1));
    Go(action);
    $('body').on('click', "a", function( event ) {
      //event.preventDefault();
      var url = $(this).attr('href');
      action = url.substring(url.lastIndexOf("#"))
      //action = location.hash;
      //alert(action);
      Go(action);
      /*event.preventDefault();
      url = $(this).attr('href');
      //url = window.location.search;
      action = url.substring(url.lastIndexOf("=")+1);
      var test = '/www/index.html#' + action;
      document.location = test;*/
    });
    function Go(action) {
      switch(action) {
          case '':
            //alert('vide');
            var resp = function() {
              $.get('views/connected.html', function(data) {
                $('#content').html(data);
              });
            };
            //alert(resp);
            break;
        case '#circle':
          //alert('circle');
          $.get('views/circle.html', function(data) {
              //alert(data);
              $('#content').html(data);
            }/*, function(error) { 
                alert(error);
            }*/);
        break;
        default: 
        //alert('null');
          $.get('views/connected.html', function(data) {
              $('#content').html(data);
            });
            break;
      }
    }
    
})
